// @import 'mixins/index.scss';
@use 'mixins/index.scss' as mixins;
@use 'variables.scss' as variables;

/* Button 按钮
------------------------------- */
// 第三方字体图标大小
.el-button:not(.is-circle) i.el-icon,
.el-button i.iconfont,
.el-button i.fa,
.el-button--default i.iconfont,
.el-button--default i.fa {
  font-size: 14px !important;
}

.el-button--small i.iconfont,
.el-button--small i.fa {
  font-size: 12px !important;
}

.el-button [class*='el-icon']+span {
  margin-left: 6px;
}

/* Input 输入框、InputNumber 计数器
------------------------------- */
// 菜单搜索
.el-autocomplete-suggestion__wrap {
  max-height: 280px !important;
}

/* Form 表单
------------------------------- */
.el-form {

  // 用于修改弹窗时表单内容间隔太大问题，如系统设置的新增菜单弹窗里的表单内容
  // .el-form-item:last-of-type {
  //   margin-bottom: 0 !important;
  // }

  // 修复行内表单最后一个 el-form-item 位置下移问题
  &.el-form--inline {
    .el-form-item--large.el-form-item:last-of-type {
      margin-bottom: 22px !important;
    }

    .el-form-item--default.el-form-item:last-of-type,
    .el-form-item--small.el-form-item:last-of-type {
      margin-bottom: 18px !important;
    }

    // 修改表单项默认右边距
    .el-form-item {
      margin-right: 12px;
    }
  }

  .el-form-item .el-form-item__label .el-icon {
    margin-right: 0px;
  }
}

// 修改数字输入框默认宽度为100%
.el-input-number {
  width: 100%;
}

// https://github.com/element-plus/element-plus/pull/15352
.el-form--inline {
  .el-form-item {

    &>.el-input,
    .el-cascader,
    .el-select,
    .el-date-editor,
    .el-autocomplete {
      width: 240px;
    }
  }
}

/* Alert 警告
------------------------------- */
.el-alert {
  border: 1px solid;
}

.el-alert__title {
  word-break: break-all;
}

/* Message 消息提示
------------------------------- */
.el-message {
  min-width: unset !important;
  padding: 15px !important;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.02);
}

/* NavMenu 导航菜单
------------------------------- */
// 鼠标 hover 时颜色
.el-menu-hover-bg-color {
  background-color: var(--next-bg-menuBarActiveColor) !important;
}

// 默认样式修改
.el-menu {
  border-right: none !important;
  width: 100%;
}

.el-menu-item {
  height: 56px !important;
  line-height: 56px !important;
}

.el-menu-item,
.el-sub-menu__title {
  color: var(--next-bg-menuBarColor) !important;
}

// 修复点击左侧菜单折叠再展开时，宽度不跟随问题
.el-menu--collapse {
  width: 64px !important;
}

// 外部链接时
.el-menu-item a,
.el-menu-item a:hover,
.el-menu-item i,
.el-sub-menu__title i {
  color: inherit;
  text-decoration: none;
}

// 第三方图标字体间距/大小设置
.el-menu-item .iconfont,
.el-sub-menu .iconfont,
.el-menu-item .fa,
.el-menu-item .svg-icon,
.el-sub-menu .svg-icon,
.el-sub-menu .fa {
  @include mixins.generalIcon;
}

// 水平菜单、横向菜单高亮 背景色，鼠标 hover 时，有子级菜单的背景色
.el-menu-item.is-active,
.el-sub-menu.is-active .el-sub-menu__title,
.el-sub-menu:not(.is-opened):hover .el-sub-menu__title {
  @extend .el-menu-hover-bg-color;
}

.el-menu-item:hover {
  @extend .el-menu-hover-bg-color;
}

.el-sub-menu.is-active.is-opened .el-sub-menu__title {
  background-color: unset !important;
}

// 水平菜单、横向菜单折叠 a 标签
.el-popper.is-dark a {
  color: var(--el-color-white) !important;
  text-decoration: none;
}

// 解决wujie微前端模式下tooltip定位偏移
.el-popper {
  position: absolute !important;
}

// 横向菜单（经典、横向）布局
.el-menu.el-menu--horizontal {
  border-bottom: none !important;
  width: 100% !important;

  // 横向布局默认选中的字体颜色同步为左侧菜单颜色（默认黑色）
  .el-sub-menu.is-active .el-sub-menu__title {
    color: var(--next-bg-menuBarColor) !important;
  }

  // 经典布局，当选中状态的时候字体颜色同步为左侧菜单颜色（默认黑色）
  .el-menu-item,
  .el-sub-menu__title {
    height: 50px !important;
    color: var(--next-bg-topBarColor) !important;

    &:hover,
    &.is-active {
      color: var(--next-bg-menuBarColor) !important;
    }
  }

  .el-menu-item:not(.is-active):hover,
  .el-sub-menu:not(.is-active):hover .el-sub-menu__title {
    color: var(--next-bg-topBarColor);
  }
}

/* Tabs 标签页
------------------------------- */
.el-tabs__nav-wrap::after {
  height: 1px !important;
}

/* Dropdown 下拉菜单
------------------------------- */
.el-dropdown-menu {
  list-style: none !important;
  /*修复 Dropdown 下拉菜单样式问题 2022.03.04*/
}

.el-dropdown-menu .el-dropdown-menu__item {
  white-space: nowrap;

  &:not(.is-disabled):hover {
    background-color: var(--el-dropdown-menuItem-hover-fill);
    color: var(--el-dropdown-menuItem-hover-color);
  }
}

/* Steps 步骤条
------------------------------- */
.el-step__icon-inner {
  font-size: 30px !important;
  font-weight: variables.$weight-regular !important;
}

.el-step__title {
  font-size: 14px;
}

/* Dialog 对话框
------------------------------- */
.el-overlay {
  overflow: hidden;

  .el-overlay-dialog {
    display: flex;
    align-items: center;
    justify-content: center;
    position: unset !important;
    width: 100%;
    height: 100%;

    .el-dialog {
      margin: 0 auto !important;
      position: absolute;

      .el-dialog__body {
        padding: 20px !important;
      }
    }
  }
}

.el-dialog__body {
  max-height: calc(90vh - 80px) !important;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Card 卡片
------------------------------- */
.el-card__header {
  padding: 15px 20px;
}

// 日历
.el-calendar-table .el-calendar-day {
  height: 50px;
  padding: 0;
}

/* Table 表格 element plus 2.2.0 版本
------------------------------- */
// 表格修改默认颜色
.el-table {
  color: variables.$text-normal;

  .el-button.is-text {
    padding: 0;
  }

  /* 修改表格空样式 */
  .el-table__empty-block {
    position: relative;
    min-height: 200px;

    /* 隐藏默认文本 */
    span {
      display: none;
    }

    &::before {
      content: "";
      display: block;
      position: absolute;
      top: 30%;
      width: 60px;
      height: 60px;
      background: url('@/assets/icons/empty-logo.png') no-repeat center center;
      background-size: 60px 60px;
    }

    &::after {
      content: "没有更多数据了";
      display: block;
      position: absolute;
      top: calc(30% + 60px);
      font-size: 14px;
      color: variables.$text-normal;
      line-height: variables.$line-height-large;
    }
  }

  /* 表格表头样式 */
  .el-table__header {
    background-color: #ffffff;
    height: 46px;
    font-size: 14px;
    font-weight: variables.$weight-bold;
    line-height: 46px;
    text-align: center;
  }

  /* 表格内容行样式 */
  .el-table__body {
    background-color: #fff;
  }

  .el-table__row {
    height: 40px;
    font-size: 14px;
    line-height: 40px;
  }

  /* 偶数行背景色 */
  .el-table__row:nth-child(even) {
    background-color: #f4f4f4;
  }

  /* 单行文字小于12个字居中，12个字及以上左对齐 */
  .el-table__cell {
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .el-table__cell span {
    word-break: break-word;
  }

  .el-table__header .el-table__cell {
    text-align: center;
    line-height: 46px;
  }

  /* 多行文字的行高为1.5倍，上下间距12px */
  .el-table__cell {
    line-height: variables.$line-height-normal;
    padding: 12px 0;
    word-wrap: break-word;
  }

  /* 表头固定吸顶 */
  .el-table__header-wrapper {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #ffffff;
  }

  /* 多行表头背景高度 46px */
  .el-table__header th {
    height: 46px;
    background-color: #fafafa;
    text-align: center;
  }
}


/* scrollbar
------------------------------- */
.el-scrollbar__bar {
  z-index: 4;
}

/*防止页面切换时，滚动条高度不变的问题（滚动条高度非滚动条滚动高度）*/
.el-scrollbar__wrap {
  max-height: 100%;
}

.el-select-dropdown .el-scrollbar__wrap {
  overflow-x: scroll !important;
}

/*修复Select 选择器高度问题*/
.el-select-dropdown__wrap {
  max-height: 274px !important;
}

/*修复Cascader 级联选择器高度问题*/
.el-cascader-menu__wrap.el-scrollbar__wrap {
  height: 204px !important;
}

/*用于界面高度自适应（main.vue），区分 scrollbar__view，防止其它使用 scrollbar 的地方出现滚动条消失*/
.layout-container-view .el-scrollbar__view {
  height: 100%;
}

/*防止分栏布局二级菜单很多时，滚动条消失问题*/
.layout-columns-warp .layout-aside .el-scrollbar__view {
  height: unset !important;
}

/* Pagination 分页
------------------------------- */
.el-pagination__editor {
  margin-right: 8px;
}

.el-pagination {
  margin-top: 15px;
  justify-content: flex-end;
}

/*深色模式时分页高亮问题*/
.el-pagination.is-background .btn-next.is-active,
.el-pagination.is-background .btn-prev.is-active,
.el-pagination.is-background .el-pager li.is-active {
  background-color: var(--el-color-primary) !important;
  color: var(--el-color-white) !important;
}

.el-pagination__jump .el-input .el-input__inner {
  padding: 0;
}

/* 空状态
-------------------------- */
.el-empty {
  --el-empty-padding: 0 0 !important;
}

// 防止被tailwindcss默认样式覆盖
svg {
  display: inline;
  vertical-align: baseline;
}

/* 全局按钮样式
------------------------------- */
.el-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  font-size: 14px;
  border-radius: 4px;
  white-space: nowrap;
  box-sizing: border-box;
  transition: all 0.3s ease;
  height: 32px;
  min-width: 74px;
  margin-right: 16px;
}

/* 小按钮 */
.el-button--small {
  min-width: 58px;
  height: 24px;
  margin-right: 8px;
  padding: 0 12px;
  font-size: 12px;
}

/* 大按钮 */
.el-button--large {
  min-width: 96px;
  height: 40px;
  margin-right: 24px;
  padding: 0 24px;
  font-size: 16px;
}

/* 按钮类型 */
.el-button--primary {
  background-color: #409eff;
  border-color: #409eff;
  color: #fff;
}

.el-button--secondary {
  background-color: #f0f0f0;
  border-color: #dcdfe6;
  color: #606266;
}

.el-button--info {
  background-color: #909399;
  border-color: #909399;
  color: #fff;
}

.el-button--warning {
  background-color: #e6a23c;
  border-color: #e6a23c;
  color: #fff;
}

.el-button--danger {
  background-color: #f56c6c;
  border-color: #f56c6c;
  color: #fff;
}

.el-button--text {
  background-color: transparent;
  border: none;
  color: #409eff;
  padding: 0;
}

/* 切换按钮样式 */
.el-button--toggle {
  background-color: #67c23a;
  border-color: #67c23a;
  color: #fff;
}

/* 带 Icon 按钮 */
.el-button--icon {
  padding-left: 8px;
  padding-right: 8px;
}

.el-button--icon i {
  margin-right: 4px;
}

/* Normal 状态（默认） */
.el-button--normal {
  background-color: #409eff;
  border-color: #409eff;
  color: #fff;
}

/* Hover 状态 */
.el-button:hover {
  opacity: 0.9;
}

/* Active 状态（激活时） */
.el-button:active {
  opacity: 0.8;
}

/* Unclickable 状态（不可点击） */
.el-button {
  &.unclickable-button {
    background-color: #dcdfe6 !important;
    border-color: #dcdfe6 !important;
    color: #c0c4cc !important;
    cursor: not-allowed !important;

    &::hover {
      background: #dcdfe6 !important;
      border-color: #dcdfe6 !important;
      color: #c0c4cc !important;
      cursor: not-allowed !important;
      opacity: 1 !important;
    }
  }
}


/* Disable 状态（禁用状态） */
.el-button:disabled {
  background-color: #f5f7fa;
  border-color: #dcdfe6;
  color: #c0c4cc;
  cursor: not-allowed;
}

/* Loading 状态（等待状态） */
.el-button.is-loading {
  position: relative;
  background-color: #409eff !important;
  border-color: #409eff !important;
  color: #fff !important;
  pointer-events: initial !important;
}

.el-button--loading:after {
  content: " ";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20px;
  height: 20px;
  border: 2px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: loading 1s linear infinite;
}

@keyframes loading {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* 小、中、大按钮的状态 */
.el-button--small.el-button--loading:after,
.el-button--medium.el-button--loading:after,
.el-button--large.el-button--loading:after {
  width: 16px;
  height: 16px;
}

/* 按钮组的样式 */
.el-button-group {
  display: flex;
  align-items: center;
}

/* 输入框的尺寸和状态样式
------------------------------- */
/* 中尺寸和大尺寸输入框 */
.el-input--medium .el-input__inner {
  height: 32px !important;
}

.el-input--large .el-input__inner {
  height: 40px !important;
}

/* 悬停状态 */
.el-input:hover .el-input__inner {
  border-color: #409eff;
}

/* 激活状态 */
.el-input.is-focus .el-input__inner {
  border-color: #409eff;
  box-shadow: 0 0 4px rgba(64, 158, 255, 0.5);
}

/* 失焦状态 */
.el-input.is-blur .el-input__inner {
  border-color: #dcdfe6;
}

/* 禁用状态 */
.el-input.is-disabled .el-input__inner {
  background-color: #f5f7fa;
  border-color: #e4e7ed;
  color: #c0c4cc;
}

/* 成功状态 */
.el-input.is-success .el-input__inner {
  border-color: #67c23a;
  box-shadow: 0 0 4px rgba(103, 194, 58, 0.5);
}

/* 错误状态 */
.el-input.is-error .el-input__inner {
  border-color: #f56c6c;
  box-shadow: 0 0 4px rgba(245, 108, 108, 0.5);
}

/* 输入框的公共样式 */
.el-input .el-input__inner {
  border-radius: 4px;
  padding-left: 10px;
  font-size: 14px;
  transition: all 0.3s ease;
}

/* 选择器的尺寸和状态样式 
----------------------------------*/

/* 中尺寸和大尺寸选择器 */
.el-select--medium .el-select__input {
  height: 32px !important;
}

.el-select--large .el-select__input {
  height: 40px !important;
}

/* 常规选择器悬停状态 */
.el-select:hover .el-select__input {
  border-color: #409eff;
}

/* 常规选择器激活状态 */
.el-select.is-focus .el-select__input {
  border-color: #409eff;
  box-shadow: 0 0 4px rgba(64, 158, 255, 0.5);
}

/* 常规选择器失焦状态 */
.el-select.is-blur .el-select__input {
  border-color: #dcdfe6;
}

/* 常规选择器禁用状态 */
.el-select.is-disabled .el-select__input {
  background-color: #f5f7fa;
  border-color: #e4e7ed;
  color: #c0c4cc;
}

/* 常规选择器的成功状态 */
.el-select.is-success .el-select__input {
  border-color: #67c23a;
  box-shadow: 0 0 4px rgba(103, 194, 58, 0.5);
}

/* 常规选择器的错误状态 */
.el-select.is-error .el-select__input {
  border-color: #f56c6c;
  box-shadow: 0 0 4px rgba(245, 108, 108, 0.5);
}

/* 日历选择器状态样式 */

/* 日历选择器悬停状态 */
.el-date-picker .el-input__inner:hover {
  border-color: #409eff;
}

/* 日历选择器选中状态 */
.el-date-picker .el-input__inner.is-selected {
  border-color: #67c23a;
  background-color: #67c23a !important;
}

/* 日历选择器禁用状态 */
.el-date-picker.is-disabled .el-input__inner {
  background-color: #f5f7fa;
  border-color: #e4e7ed;
  color: #c0c4cc;
}

/* 公共样式 */
.el-select__input,
.el-date-picker .el-input__inner {
  border-radius: 4px;
  padding-left: 10px;
  font-size: 14px;
  transition: all 0.3s ease;
}